/**
 * Copyright (c) 2016 ShopJsp. All Rights Reserved.
 * ============================================================================
 * 版权所有 2011 - 今 北京华宇盈通科技有限公司，并保留所有权利。
 * ----------------------------------------------------------------------------
 * 提示：在未取得SHOPJSP商业授权之前，您不能将本软件应用于商业用途，否则SHOPJSP将保留追究的权力。
 * ----------------------------------------------------------------------------
 * 官方网站：http://www.shopjsp.com
 * ============================================================================
 */

package com.hyyt.shopjsp.wxmg.util;

import java.io.UnsupportedEncodingException;

import org.tuckey.web.filters.urlrewrite.utils.Log;

import com.hyyt.shopjsp.util.encode.Base64;

public class WxBase64 {
	
	private static Log logger = Log.getLog(WxBase64.class);
	
	public static String encode(String code){
		try {
			return new String(Base64.encodeBase64(code.getBytes("utf-8")),"utf-8");
		} catch (UnsupportedEncodingException e) {
			logger.error(e);
		} catch (RuntimeException e) {
			logger.error(e);
		}
		return null;
	}
	public static String decode(String code){
		try {
			return new String(Base64.decodeBase64(code.getBytes("utf-8")),"utf-8");
		} catch (UnsupportedEncodingException e) {
			logger.error(e);
		} catch (RuntimeException e) {
			logger.error(e);
		}
		return null;
	}
}
